package com.xsd.responsibilitychain;

/**
 * @Description: 职责链模式
 * @Author: zhoufuzong
 * @Created: 2021-03-07 22:09:10
 * @Version: 1.1.0
 */

public class Client {
    public static void main(String[] args) {
        PurchaseRequest purchaseRequest = new PurchaseRequest(1,6000,1);

        // 创建相关的审批人
        DepartmentApprover  departmentApprover= new DepartmentApprover("张主任");
        CollegeApprover collegeApprover = new CollegeApprover("李院长");
        ViceShcoolMasterApprover viceShcoolMasterApprover = new ViceShcoolMasterApprover("王副校长");
        ShcoolMasterApprover shcoolMasterApprover = new ShcoolMasterApprover("赵校长");


        // 需要将各个审批级别的下一个设置好, 处理人构成一个环形
        departmentApprover.setApprover(collegeApprover);
        collegeApprover.setApprover(viceShcoolMasterApprover);
        viceShcoolMasterApprover.setApprover(shcoolMasterApprover);
        shcoolMasterApprover.setApprover(departmentApprover);

        shcoolMasterApprover.processRequest(purchaseRequest);



    }

}
